import React from 'react';
import { Text, View } from 'react-native';
import Spin from 'react-native-loading-spinner-overlay';

const ts = {
  color: '#fff',
  fontSize: 16,
  marginTop: -40
}

export default ({
  visible = false,
  textContent = '正在加载数据',
  textStyle = ts,
  size = 'large',
  animation = 'fade',
  overlayColor = 'rgba(255, 255, 255, 0.5)',
  color = '#333',
  children,
}) => (
    <View style={{ flex: 1 }}>
      <Spin
        visible={visible}
        textContent={textContent}
        size={size}
        animation={animation}
        overlayColor={overlayColor}
        color={color}
        textStyle={textStyle}
      />
      {visible ? null : children}
    </View>
  );
